package edu.pku.hawk.sandbox;

import flex.messaging.messages.AsyncMessage;
import flex.messaging.messages.Message;
import flex.messaging.services.MessageService;
import flex.messaging.services.ServiceAdapter;

public class SandtableCtrlServiceAdapter extends ServiceAdapter{

	
	@Override
	public Object invoke(Message msg) {
		if(msg.getBody()!=null)
		{
			SandtableCtrlMsg nmsg=(SandtableCtrlMsg)msg.getBody();
			System.out.println("msgtype:"+nmsg.msgtype+"  sensortype:"+nmsg.sensortype);
			AsyncMessage newMsg=(AsyncMessage) msg;
			MessageService msgService=(MessageService) getDestination().getService();
			msgService.pushMessageToClients(newMsg, true);
			return "Success";
		}
		return null;
	}

}
